package com.example.hospital_208.service.impl;

import com.example.hospital_208.dao.CarouselDao;
import com.example.hospital_208.po.Carousel;
import com.example.hospital_208.service.CarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service // 标记为 Spring Service Bean
public class CarouselServiceImpl implements CarouselService {

    @Autowired // 自动注入 DAO
    private CarouselDao carouselDao;

    @Override
    public List<Carousel> listCarousels() {
        return carouselDao.selectAll();
    }

    @Override
    public Carousel getCarouselById(Integer id) {
        return carouselDao.selectById(id);
    }

    @Override
    public int addCarousel(Carousel carousel) {
        return carouselDao.insert(carousel);
    }

    @Override
    public int updateCarousel(Carousel carousel) {
        return carouselDao.update(carousel);
    }

    @Override
    public int deleteCarousel(Integer id) {
        return carouselDao.deleteById(id);
    }
}